<!--
 * @Desc: 
 * @Version: v1.00
 * @Author: went
 * @Date: 2022-07-11 14:19:18
 * @LastEditors: went
 * @LastEditTime: 2023-06-09 16:43:11
-->
<template>
  <div class="container">
    <a-spin size="large" :tip="tip">
      <div class="container"></div>
    </a-spin>
  </div>
</template>
<script lang="ts" setup>
// import { ENTER_WAY, SYS_TOKEN, SYS_ORGCODE } from "@/utils/global-constant";
// import { requestSysInfo } from "@/service/modules/public/public";
import { useStore } from "vuex";
import router from "@/router";
// import { useRouter } from "vue-router";
import { SYS_TOKEN, SYS_ORGCODE } from "@/utils/global-constant";
import { getQueryString } from "@/utils/utils";
import LocalCache from "@/utils/cache";
const tip = "加载中...";
const store = useStore();
//模拟接口菜单数据
const menuList = [
  {
    spyCode: "zxb_01",
    title: "菜单一",
    children: [],
  },
  {
    spyCode: "zxb_02",
    title: "菜单二",
    children: [
      {
        spyCode: "zxb_02_01",
        title: "子菜单一",
      },
      {
        spyCode: "zxb_02_02",
        title: "子菜单二",
      },
    ],
  },
];
//系统初始化
initIdentity();
/**
 * @desc: 初始化
 * @author: went
 */
function initIdentity() {
  LocalCache.setSession(SYS_TOKEN, getQueryString("token"));
  LocalCache.setSession(SYS_ORGCODE, getQueryString("orgCode"));
  getMenu();
}
/**
 * @desc: 获取用户信息
 * @author: went
 */
async function getSysInfo() {
  // 根据业务需求确定是否需要调用接口
  // const res = await requestSysInfo({});
  // if (res?.code === "200") {
  //   LocalCache.setSession("sysInfo", res.data);
  //   router.push("/home");
  // } else {
  //   Toast(res?.message);
  // }
}
function getMenu() {
  if (!(window as any).__POWERED_BY_QIANKUN__) {
    store.dispatch("addRoutes/actionMenu", menuList);
  }
 
  setTimeout(() => {
    router.push("/home");
  }, 0);
  getSysInfo();
}
</script>

<style scoped lang="less">
.container {
  width: 100%;
  height: 100vh;
}
</style>
